
import cv2

cap = cv2.VideoCapture(0)

while(True):
    ret,frame = cap.read()
    gray = cv2.cvtColor(frame,cv2.COLOR_RGB2GRAY)
    #图像 ，起点，终点，BGR,粗细
    cv2.line(frame,(0,0),(100,100),(0,255,0),2)
    cv2.rectangle(frame,(0,0),(100,100),(255,255,0),3)# -负值是填充实心
    #图像,圆心，半径，颜色，粗细（-为填充）
    cv2.circle(frame,(50,50),50,(255,255,255),2)
    font=cv2.FONT_HERSHEY_TRIPLEX
    cv2.putText(frame,'OpenCV',(150,100), font, 1,(255,255,255),1)
    cv2.putText(frame,'GUI Demo',(200,50), font, 1,(0,255,255),1)
    cv2.imshow('fream',frame)
    if cv2.waitKey(20)&0xFF==27:
        break
cap.release()
cv2.destroyAllWindows()